
function listenToShared() {
    evt.listenTo('on-post-shared', function(data) {
        var tid = data.tid;

        var dom = $api.dom('#share-panel .invite-share-cell[data-tid="'+tid+'"]');
        $api.addCls(dom, 'shared');
        
        if (dom) {
            var shareBtn = $api.dom(dom, '.share-btn');
            var shareNum = parseInt(shareBtn.innerHTML.replace('分享(', ''));
            shareBtn.innerHTML = '分享(' + ((shareNum ? shareNum : 0) + 1) + ')';
        }
        
    });
}

function isshared(tid) {
    return app.sharedTIdStore.getShared(tid) ? 'shared' : '';
}

function requestAndRenderSharelist(bRefresh) {
    if (bRefresh) {
        window.cur_page = 0;
    }
    var q = {
        start: window.cur_page,  // 注意: 是页数，不是起始索引
        count: window.count_per_load
    };
	std_ajax_get('wuchen/hotincomming.php', q, {
        always: function() {
            rmPageLoading();
            rmFooterLoading();
			utils.setRefreshDone();
        },
		succ: function(json, url) {
            if (json && json.list && json.list.length > 0) {
                var html = doT_Render('#tpl-share-list', json.list);
                var dom = $api.dom('#share-panel');
                if (bRefresh) {
                    $api.html(dom, html);
                } else {
                    $api.append(dom, html);
                }

                sofast();
                window.cur_page++;
            } else {
                window.cur_page = -1;
            }
		},
        fail: function(err, url) {
            utils.postErrWithTips(err, url);
        }
	});
}
